package com.foreknow.mapper;

import com.foreknow.entity.Rule;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface RuleMapper {

    /**
     * 查询排班规则
     * @param deptCategoryId
     * @param deptId
     * @param registLeId
     * @return
     */
    public List<Rule> getRule(Integer deptCategoryId,Integer deptId,Integer registLeId);

    /**
     * 新增排班规则
     * @param list
     * @return
     */
    public int addRule(List<Rule> list);

    /**
     * 修改排班规则
     * @param ruleName
     * @param deptID
     * @param userID
     * @param week
     * @param id
     * @return
     */
    @Update("update rule set RuleName = #{ruleName},DeptID = #{deptID},UserID = #{userID},Week = #{week} where ID = #{id}")
    public int updateRule(String ruleName,Integer deptID,Integer userID,String week,Integer id);

    /**
     * 删除排班规则
     * @param ruleId
     * @return
     */
    @Delete("delete from rule where ID = #{ruleId}")
    public int deleteRule(Integer ruleId);
}
